/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __TERRAIN_TEXTURE_ARCHIVE_H__
#define __TERRAIN_TEXTURE_ARCHIVE_H__

#include "NgPrerequisites.h"
#include "GPKArchive.h"

namespace PQEngine
{
	/*Manage a scene's terrain texture,name tobe TerrainTextureArchive is better?
	*/
	class TerrainTextureArchive
	{
	public:
		static const std::string TERRAIN_TEXTURE_ARCHIVE_NAME;
		
	public:
		TerrainTextureArchive();

		/*Add texture image file from local file system according to file path.
		*/
		bool addTextureFromLocalFS(std::string filePath);
		GPKFile* getTextureFile(int index);
		GPKFile* getTextureFile(std::string name);

		inline int getNumTexture()
		{
			int size=_nameList.size();
			return size;
		}

		inline std::string getTextureName(int index)
		{
			int size=_nameList.size();
			if(index>=0&&index<size){
				return _nameList[index];
			}
			return "";//or return procedure build texture?
		}

		inline void select(int index)
		{
			_selectedIndex=index;
		}

		inline int getSelected(int index)
		{
			return _selectedIndex;
		}
	private:
		void loadTexture(int index);
	private:
		GPKArchive* _archive;//the terrain texture archive.
		StringVector _nameList;

		int _selectedIndex;

	};
}

#endif
